/*
 * File: exercise4.cpp
 * -------------------
 * capitalize(srt) function 
 * compile command :
 * g++ -Wall -g exercise4.cpp -o exercise4 -lStanfordCPPLib -I ../include/
 */

#include <iostream>
#include <string>
#include <error.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

string capitalize(string str);

int main()
{
	string str1 = "BOOLEAN";
	string str2 = "boolean";
	cout<<capitalize(str1)<<endl;
	cout<<capitalize(str2)<<endl;
	return 0;
}

string capitalize(string str)
{
	int nchars = str.length();
	string newstr;
	for(int i = 0; i < nchars; i++)
	{
		if(i == 0)
		{
			if(islower(str[i]))
				str[i] = toupper(str[i]);
		}
		else
		{
			if(isupper(str[i]))
				str[i] = tolower(str[i]);
		}
	}
	return str;
}
